package com.foogui.service.impl;

import com.foogui.service.StockService;
import io.seata.spring.annotation.GlobalLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;


@Service
public class StockServiceImpl implements StockService {
    @Autowired
    private JdbcTemplate jdbcTemplate;


    @Override
    public Integer reduce(String commodityCode, Integer count) {
        return jdbcTemplate.update("update t_stock set count = count - ? where commodity_code = ?",
                new Object[] {count, commodityCode});
    }
}
